<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>API测试</title>
</head>
<body>
    <h1>权限API测试</h1>

    <button onclick="testPermissionsAPI()">测试权限API</button>
    <button onclick="testRolesAPI()">测试角色API</button>

    <div id="result"></div>

    <script>
        async function testPermissionsAPI() {
            try {
                const response = await fetch('http://localhost:8080/role/permissions');
                const data = await response.json();

                document.getElementById('result').innerHTML =
                    '<h3>权限API结果:</h3><pre>' + JSON.stringify(data, null, 2) + '</pre>';
            } catch (error) {
                document.getElementById('result').innerHTML =
                    '<h3>权限API错误:</h3><pre>' + error.message + '</pre>';
            }
        }

        async function testRolesAPI() {
            try {
                const response = await fetch('http://localhost:8080/role/list');
                const data = await response.json();

                document.getElementById('result').innerHTML =
                    '<h3>角色API结果:</h3><pre>' + JSON.stringify(data, null, 2) + '</pre>';
            } catch (error) {
                document.getElementById('result').innerHTML =
                    '<h3>角色API错误:</h3><pre>' + error.message + '</pre>';
            }
        }
    </script>
</body>
</html>